/*
 * StudentIdName.java
 *
 * Created on November 3, 2007, 12:58 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package unidad7;

public class StudentIdName {

    private int[] StudentId = {101,102,104,105,106};
    private String[] StudentName = {"Rudy","Emmanuel","Matos","Perez","Ricard"}; 
    
    /** Creates a new instance of StudentIdName */
    public StudentIdName() {
    }
    
    
    public void setStudentId(int index, int value){
    
        String sustituto = String.valueOf(value);
        ArrayDemo.replaceArrayElement(StudentId,index,sustituto);    
    
    }
    
    public void setStudentName(int index, String value){
        
        ArrayDemo.replaceArrayElement(StudentName,index, value);
    }

    public int getStudentId(int index){
        
       return StudentId[index];
    }
     
    public String getStudentName(int index){
        
       return StudentName[index];
    }
    
    public String getStudentNameThroughId(int id){
        
        int i = -1;
        
        do{
        
            ++i;
            
        }while(StudentId[i] != id);
    
        return getStudentName(i);
    }
}
